Skip to content

configurable request header for determining peer#6063

Merged
rnewson merged 1 commit into
mainfrom
custom-peer-header
Jul 20, 2026
Merged

configurable request header for determining peer#6063
rnewson merged 1 commit into
mainfrom
custom-peer-header

Conversation

@rnewson

@rnewson rnewson commented Jul 10, 2026

Copy link
Copy Markdown
Member

Overview

Allow peer determination by a custom header, useful when CouchDB is behind a reverse proxy or load balancer.

In the absence of the header the usual logic is used to determine peer (the x-forwarded-for header logic in mochiweb).

Testing recommendations

covered by tests.

Related Issues or Pull Requests

#6052

Checklist

  • This is my own work, I did not use AI, LLM's or similar technology
  • Code is written and works correctly
  • Changes are covered by tests
  • Any new configurable parameters are documented in rel/overlay/etc/default.ini
  • Documentation changes were made in the src/docs folder
  • Documentation changes were backported (separated PR) to affected branches

@rnewson
rnewson force-pushed the custom-peer-header branch from b615fe3 to fb66a58 Compare July 19, 2026 19:17
@rnewson
rnewson marked this pull request as ready for review July 19, 2026 19:17
@rnewson
rnewson requested review from janl and nickva and removed request for janl July 19, 2026 19:18
@rnewson
rnewson force-pushed the custom-peer-header branch 2 times, most recently from 4f7db1c to 37eade8 Compare July 19, 2026 20:20

@nickva nickva left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! Just a left a few notes. Some are nits and some are questions I had.

An interesting aspect here might be that if users would set a peer_header they should be warned that they should also prevent clients from controlling that header. The proxy should clear that clients' header, and replace it with its own. Otherwise, it would be a trivial for clients to bypass the lockout by sending random values for the header they now control.

Comment thread rel/overlay/etc/default.ini Outdated
Comment thread src/docs/src/config/http.rst Outdated
Comment thread src/couch/src/couch_auth_lockout.erl
Comment thread src/chttpd/src/chttpd.erl Outdated
Comment thread src/chttpd/src/chttpd.erl Outdated
Comment thread src/chttpd/src/chttpd.erl Outdated
Comment thread src/chttpd/src/chttpd.erl
@rnewson
rnewson force-pushed the custom-peer-header branch 4 times, most recently from d756ca9 to 8353785 Compare July 20, 2026 15:54

@nickva nickva left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look much tidier. Just a few more notes and maybe we can do some deduplication, still

Comment thread src/docs/src/config/http.rst
Comment thread src/couch/src/couch_httpd.erl Outdated
@rnewson
rnewson force-pushed the custom-peer-header branch 2 times, most recently from 67a778a to 4ae1bbd Compare July 20, 2026 18:40

@nickva nickva left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@rnewson
rnewson force-pushed the custom-peer-header branch from 4ae1bbd to 307e4d9 Compare July 20, 2026 19:17
@rnewson
rnewson merged commit 0ea4747 into main Jul 20, 2026
55 checks passed
@rnewson
rnewson deleted the custom-peer-header branch July 20, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants